home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / util / misc / cookies.lha / Cookie / cookhash.lex < prev    next >
Text File  |  1995-04-27  |  634b  |  51 lines

  1. /*
  2.  * cookhash 2.0
  3.  * Jörgen Grahn 1995-04-27
  4.  *
  5.  * generates file for random selection of cookies
  6.  * from a fortune cookie file
  7.  *
  8.  * cookhash <cookiefile >hashfile
  9.  *
  10.  * format of the cookie file:
  11.  *
  12.  * comment
  13.  * cookie
  14.  * comment
  15.  * cookie
  16.  * ...
  17.  * comment
  18.  * cookie
  19.  *
  20.  * where 'comment' is a bunch of rows starting with '%%'
  21.  *
  22.  *
  23.  * Compile with 'flex' and then an ANSI C compiler.
  24.  *
  25.  */
  26.  
  27.     int filepos = 0;
  28.  
  29.     static char verstring[] = "$" "VER: cookhash 2.0 (27.4.95)";
  30.  
  31.  
  32. %%
  33.  
  34. (\%\%.*\n)+    {
  35.                 filepos += yyleng;
  36.                 printf("%06lx\n",filepos);
  37.             }
  38.  
  39. (.|\n)        {
  40.                 filepos += yyleng;
  41.             }
  42.  
  43. %%
  44.  
  45. main()
  46. {
  47.     yylex();
  48.  
  49.     exit(0);
  50. }
  51.